//
//  DiaryTableViewCell.m
//  PSYWeiBo
//
//  Created by K.Keyboard on 16/3/16.
//  Copyright © 2016年 郑亚田. All rights reserved.
//

#import "DiaryTableViewCell.h"

@implementation DiaryTableViewCell
/*
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addAllViews];
    }
    return self;
}
-(void)addAllViews{
    self.label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 200, 100)];
    //文字换行方法
    self.label.numberOfLines = 0;
    [self.contentView addSubview:self.label];
}
//实现类方法计算高度
+(CGFloat)cellHeightWithString:(NSString *)str{
    
    //限定宽度的参数
    //宽度也一定是跟控件设定的宽度一样
    CGSize size = CGSizeMake(200, MAXFLOAT);
    //设置字体大小
    //这里写的字体大小一定要跟控件中设定的字体大小一样
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:17]};
    
    //计算一段文本在限定宽度和限定字体大小的情况下占据的矩形框大小
    //attributes 参数必须是字典 所以定义字典接收(dic)
    CGRect rect = [str boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    return rect.size.height;
}
*/

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
